﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_ManufactureList.cshtml";
}
<script type="text/javascript">
    var status = '@ViewBag.status';
    var number = '@ViewBag.number';
    $(function () {
        initControl();
    });
    function initControl() {
        if (status == 'U') {
            if ($('#oldEntity').val() != '') {
                var data = JSON.parse($('#oldEntity').val());
                setDataByJson("#form1", data);
            }
            $('#checkbox_list').find('input[type=hidden]').each(function () {
                var id = $(this).prop('id') + "_Box";
                if ($(this).val() == "1") {
                    $('#' + id).prop("checked", true);
                } else {
                    $('#' + id).prop("checked", false);
                }
            })
            $('#UnitNO').prop("readonly", true);
        }
        initBindSelect("#form1");
    }
    function btn_ok() {
        submitForm();
    }
    function submitForm() {
        $('#checkbox_list').find('input[type=checkbox]').each(function () {
            var id = $(this).prop('id').replace("_Box", "");
            if ($(this).prop("checked")) {
                $('#' + id).val('1');
            } else {
                $('#' + id).val('0');
            }
            //alert(id + '：' + $('#' + id).val());
        })
        if (!$('#form1').formValid()) {
            return false;
        }
        $.submitForm({
            url: "/MainData/CustomerInfo/SubmitCustomerInfoForm?status=" + status + "&keyValue=" + number,
            param: $("#form1").formSerialize(),
            success: function (result) {
                if (status == 'I') {
                    parent.reloadGrid(result.data);
                } else {
                    parent.reloadGrid();
                }
                parent.$.detailClose();
            }
        })
    }
    function btn_cancel() {
        parent.$.detailClose();
    }
</script>
<div class="ui-layout" id="layout" style="height: 96%; width: 100%;">
    <input id="oldEntity" type="hidden" value="@ViewBag.oldEntity" />
    <form id="form1">
        <div style="width:950px;margin:0 auto;">
            <table class="form" style="width:900px;text-align:right;margin:15px;border-bottom:2px solid #ccc;">
                <tr>
                    <td class="formValue input-width-185" style="width:500px;padding-left:100px;text-align:left;">
                        &nbsp;
                    </td>
                    <td style="width: 300px; padding: 5px 10px;">
                        <div class="btn-group" style="margin-right:20px;">
                            <a id="" class="btn btn-primary center-block" onclick="btn_ok()"><span class="glyphicon glyphicon-ok"></span> 确认</a>
                        </div>
                        <div class="btn-group">
                            <a id="" class="btn btn-primary center-block" onclick="btn_cancel()"><span class="glyphicon glyphicon-remove"></span> 取消</a>
                        </div>
                    </td>
                </tr>
            </table>
            <table class="form" style="width: 900px;margin:0 15px;">
                <tr>
                    <th class="formTitle" style="width:80px;">单位编码</th>
                    <td class="formValue input-width-210" style="width:480px;">
                        <input id="UnitNO" name="UnitNO" type="text" class="form-control required" value="" />
                        <input id="UnitID" name="UnitID" type="hidden" value="" />
                    </td>
                    <th class="formTitle" style="width:80px;">&nbsp;</th>
                    <td class="formValue" style="">
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">单位全称</th>
                    <td class="formValue input-width-480">
                        <input id="UnitFullName" name="UnitFullName" type="text" class="form-control required" value="" />
                    </td>
                    <th class="formTitle">单位简称</th>
                    <td class="formValue input-width-185">
                        <input id="UnitShortName" name="UnitShortName" type="text" class="form-control" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">原单位全称</th>
                    <td class="formValue input-width-480">
                        <input id="UnitName" name="UnitName" type="text" class="form-control" value="" />
                    </td>
                    <th class="formTitle">更名时间</th>
                    <td class="formValue input-width-185">
                        <input id="AlertNameTime" name="AlertNameTime" type="text" onclick="WdatePicker()" class="form-control input-wdatepicker" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">单位地址</th>
                    <td class="formValue input-width-480">
                        <input id="UnitAddress" name="UnitAddress" type="text" class="form-control" value="" />
                    </td>
                    <th class="formTitle">&nbsp;</th>
                    <td class="formValue input-width-320">
                        &nbsp;
                    </td>
                </tr>
            </table>
            <table class="form" style="width: 900px;margin:0 15px;">
                <tr>
                    <th class="formTitle" style="width:80px;">主要采购方式</th>
                    <td class="formValue input-width-185" style="width:200px;">
                        <select id="PurchaseType" name="PurchaseType" class="form-control">
                            <option value="">&nbsp;</option>
                            @foreach (var item in ViewBag.purchaseType)
                            {
                            <option value="@item.FTypeNO">@item.FTypeNO @item.FTypeName</option>
                            }
                        </select>
                    </td>
                    <th class="formTitle" style="width:95px;">信誉等级</th>
                    <td class="formValue input-width-185" style="width: 200px;">
                        <select id="CreditLevel" name="CreditLevel" class="form-control">
                            <option value="">&nbsp;</option>
                            @foreach (var item in ViewBag.creditLevel)
                            {
                            <option value="@item.FTypeNO">@item.FTypeNO @item.FTypeName</option>
                            }
                        </select>
                    </td>
                    <th class="formTitle" style="width:66px;">配套时间</th>
                    <td class="formValue input-width-185">
                        <input id="SupportingTime" name="SupportingTime" type="text" onclick="WdatePicker()" class="form-control input-wdatepicker" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">单位性质</th>
                    <td class="formValue input-width-185" style="width:200px;">
                        <select id="UniteNature" name="UniteNature" class="form-control">
                            <option value="">&nbsp;</option>
                            @foreach (var item in ViewBag.uniteNature)
                            {
                            <option value="@item.FTypeNO">@item.FTypeNO @item.FTypeName</option>
                            }
                        </select>
                    </td>
                    <th class="formTitle">产品类型</th>
                    <td class="formValue input-width-185" style="width: 200px;">
                        <select id="ProductType" name="ProductType" class="form-control">
                            <option value="">&nbsp;</option>
                            @foreach (var item in ViewBag.productType)
                            {
                            <option value="@item.FTypeNO">@item.FTypeNO @item.FTypeName</option>
                            }
                        </select>
                    </td>
                    <th class="formTitle">&nbsp;</th>
                    <td class="formValue input-width-185">
                        &nbsp;
                    </td>
                </tr>
            </table>
            <table class="form" style="width: 900px;margin:0 15px;">
                <tr>
                    <th class="formTitle" style="width:80px;">法人代表</th>
                    <td class="formValue input-width-320" style="width:320px;">
                        <input id="LegalUser" name="LegalUser" type="text" class="form-control" value="" />
                    </td>
                    <th class="formTitle" style="width:106px;">联系人员</th>
                    <td class="formValue input-width-320" style="">
                        <input id="ContactUser" name="ContactUser" type="text" class="form-control" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">法人电话</th>
                    <td class="formValue input-width-320">
                        <input id="LegalPhone" name="LegalPhone" type="text" class="form-control" value="" />
                    </td>
                    <th class="formTitle">联系电话</th>
                    <td class="formValue input-width-320" style="">
                        <input id="ContactPhone" name="ContactPhone" type="text" class="form-control" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">法人传真</th>
                    <td class="formValue input-width-320">
                        <input id="LegalFax" name="LegalFax" type="text" class="form-control" value="" />
                    </td>
                    <th class="formTitle">联系传真</th>
                    <td class="formValue input-width-320" style="">
                        <input id="ContactFax" name="ContactFax" type="text" class="form-control" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">法人信箱</th>
                    <td class="formValue input-width-320">
                        <input id="LegalEMail" name="LegalEMail" type="text" class="form-control" value="" />
                    </td>
                    <th class="formTitle">联系信箱</th>
                    <td class="formValue input-width-320" style="">
                        <input id="ContactEMail" name="ContactEMail" type="text" class="form-control" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">公司电话</th>
                    <td class="formValue input-width-320">
                        <input id="UnitPhone" name="UnitPhone" type="text" class="form-control" value="" />
                    </td>
                    <th class="formTitle">营业执照</th>
                    <td class="formValue input-width-320" style="">
                        <input id="BusinessLicense" name="BusinessLicense" type="text" class="form-control" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">公司传真</th>
                    <td class="formValue input-width-320">
                        <input id="UnitFax" name="UnitFax" type="text" class="form-control" value="" />
                    </td>
                    <th class="formTitle">税务登记证</th>
                    <td class="formValue input-width-320" style="">
                        <input id="TaxRegistration" name="TaxRegistration" type="text" class="form-control" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">公司信箱</th>
                    <td class="formValue input-width-320">
                        <input id="UnitEMail" name="UnitEMail" type="text" class="form-control" value="" />
                    </td>
                    <th class="formTitle">订货币种</th>
                    <td class="formValue input-width-185" style="">
                        <select id="CurrencyType" name="CurrencyType" class="form-control">
                            <option value="">&nbsp;</option>
                            @foreach (var item in ViewBag.currencyType)
                            {
                            <option value="@item.FTypeNO">@item.FTypeNO @item.FTypeName</option>
                            }
                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">开户银行</th>
                    <td class="formValue input-width-320">
                        <input id="UnitBank" name="UnitBank" type="text" class="form-control" value="" />
                    </td>
                    <th class="formTitle">单位税号</th>
                    <td class="formValue input-width-320" style="">
                        <input id="UnitTariff" name="UnitTariff" type="text" class="form-control" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">银行账号</th>
                    <td class="formValue input-width-320">
                        <input id="UnitBankNO" name="UnitBankNO" type="text" class="form-control" value="" />
                    </td>
                    <th class="formTitle">辅助说明</th>
                    <td class="formValue input-width-320" style="">
                        <input id="AssistExplain" name="AssistExplain" type="text" class="form-control" value="" />
                    </td>
                </tr>
            </table>
            <table id="checkbox_list" class="form" style="width: 900px;margin:0 15px;">
                <tr>
                    <th class="formTitle" style="width:80px;">材料需求</th>
                    <td class="formValue" style="width:80px;"><input type="checkbox" id="IsCLCustomer_Box" /><input id="IsCLCustomer" name="IsCLCustomer" type="hidden" value="" /></td>
                    <th class="formTitle" style="width:80px;">材料供应商</th>
                    <td class="formValue" style="width:80px;"><input type="checkbox" id="IsMaterial_Box" /><input id="IsMaterial" name="IsMaterial" type="hidden" value="" /></td>
                    <th class="formTitle" style="width:80px;">辅料供应商</th>
                    <td class="formValue" style="width:80px;"><input type="checkbox" id="IsAccessories_Box" /><input id="IsAccessories" name="IsAccessories" type="hidden" value="" /></td>
                    <th class="formTitle" style="width:80px;">模具厂家</th>
                    <td class="formValue" style="width:80px;"><input type="checkbox" id="IsMould_Box" /><input id="IsMould" name="IsMould" type="hidden" value="" /></td>
                    <th class="formTitle" style="width:80px;">备件厂家</th>
                    <td class="formValue" style=""><input type="checkbox" id="IsBJ_Box" /><input id="IsBJ" name="IsBJ" type="hidden" value="" /></td>
                </tr>
                <tr>
                    <th class="formTitle">零件需求</th>
                    <td class="formValue"><input type="checkbox" id="IsCustomer_Box" /><input id="IsCustomer" name="IsCustomer" type="hidden" value="" /></td>
                    <th class="formTitle">零件供应商</th>
                    <td class="formValue"><input type="checkbox" id="IsProduct_Box" /><input id="IsProduct" name="IsProduct" type="hidden" value="" /></td>
                    <th class="formTitle">容器供应商</th>
                    <td class="formValue"><input type="checkbox" id="IsFContainer_Box" /><input id="IsFContainer" name="IsFContainer" type="hidden" value="" /></td>
                    <th class="formTitle">设备厂家</th>
                    <td class="formValue"><input type="checkbox" id="Isdevice_Box" /><input id="Isdevice" name="Isdevice" type="hidden" value="" /></td>
                    <th class="formTitle">承运商</th>
                    <td class="formValue"><input type="checkbox" id="IsCarrier_Box" /><input id="IsCarrier" name="IsCarrier" type="hidden" value="" /></td>
                </tr>
            </table>
        </div>
    </form>
</div>

